#ifndef RSA_KEY_H
#define RSA_KEY_H

#include <string>
#include <openssl/rsa.h>

namespace crypto
{
  namespace rsa
  {
    class RSAKey
    {
      private:
        static const unsigned long EXPONENT = 65537L;
      public:
        enum KeyType {UNDEFINED, PRIVATE, PUBLIC};

      private:
        //private:
        RSA *key;
        KeyType type;

      public:
        RSAKey();
        RSAKey(std::string filename, KeyType type);
        ~RSAKey();
        RSA * toRSA();
        void printKey();
        int size();
        RSAKey::KeyType getType();
        void readKeyFromFile(std::string filename, KeyType type);
        void generatePrivateKey(int size);
        void generatePublicKey(RSAKey *privateKey);
    };
  }
}

#endif
